package com.example.springbootecharts.controller;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@RestController
public class Tablecontroller {
    @Autowired
    @Qualifier("jdbcTemplate")
    private JdbcTemplate jdbcTemplate;


    @RequestMapping(value="/table/job_list/{joblist}")
    public String tableecharts1(@PathVariable String joblist){
        String sql = "SELECT job_name,company_name,workarea,companytype,jobwelf,job_href FROM mingxi WHERE job_name LIKE '%"+joblist+"%' LIMIT 100;";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("data", list);
        return JSON.toJSONString(map);
    }


}
